home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / c / stormamiga_lib-v45_00d / include / stormamiga.h < prev    next >
C/C++ Source or Header  |  2000-02-28  |  5KB  |  209 lines

  1. #ifndef  STORMAMIGA_H
  2. #define  STORMAMIGA_H
  3.  
  4. /*
  5. **       $VER: stormamiga.h 43.24 (26.11.98)
  6. **              Includes Release 45.00
  7. **               AmigaOS/68K Version
  8. **
  9. **    Copyright © 1996/2000 by CyberdyneSystems
  10. **
  11. **            written by Matthias Henze
  12. **               All Rights Reserved
  13. */
  14.  
  15. typedef const void              cvoid;
  16. typedef const char              cchar;
  17. typedef const signed char       cschar;
  18. typedef const unsigned char     cuchar;
  19. typedef signed char             schar;
  20. typedef unsigned char           uchar;
  21. typedef unsigned short          ushort;
  22. typedef long int                lint;
  23. typedef long long int           llint;
  24. typedef unsigned int            uint;
  25. typedef unsigned long int       ulint;
  26. typedef unsigned long long int  ullint;
  27. typedef long long               llong;
  28. typedef unsigned long           ulong;
  29. typedef unsigned long long      ullong;
  30.  
  31. #ifdef STORMAMIGA_PPC
  32.   #include <PPC_stormamiga.h>
  33. #else /* PPC */
  34.  
  35. #ifndef _INCLUDE_STDIO_H
  36.   #include <stdio.h>
  37. #endif
  38. #ifndef INTUITION_INTUITION_H
  39.   #include <intuition/intuition.h>
  40. #endif
  41. #ifndef HARDWARE_INTBITS_H
  42.   #include <hardware/intbits.h>
  43. #endif
  44. #ifndef  CLIB_ALIB_PROTOS_H
  45.   #include <clib/alib_protos.h>
  46. #endif
  47. #ifndef _INCLUDE_PRAGMA_EXEC_LIB_H
  48.   #include <pragma/exec_lib.h>
  49. #endif
  50. #ifndef _INCLUDE_PRAGMA_GRAPHICS_LIB_H
  51.   #include <pragma/graphics_lib.h>
  52. #endif
  53.  
  54. #ifdef STORMAMIGA_NOWB
  55.   void wbmain_(void) {};
  56. #endif
  57.  
  58. #ifdef STORMAMIGA_OS3
  59.   #ifdef __cplusplus
  60.     extern "C" {
  61.     void *malloc_3(size_t);
  62.     void free_3(void *); }
  63.     void *operator new(size_t bytes)
  64.     { return malloc_3(bytes); }
  65.  
  66.     void operator delete(void *mem, size_t)
  67.     { free_3(mem); }
  68.   #endif
  69. #endif
  70.  
  71. #ifdef STORMAMIGA_STACK
  72.   long stack = STORMAMIGA_STACK;
  73.   extern "C" {void INIT_9_Stack(void);}
  74.   static void _initstack(void)
  75.   { INIT_9_Stack(); }
  76. #endif
  77.  
  78. #ifdef __cplusplus
  79.   extern "C" {
  80. #endif
  81.  
  82. #ifdef STORMAMIGA_NO_IO_WB
  83.   void ioinit_(void) {};
  84. #endif
  85.  
  86. #ifdef STORMAMIGA_OS3
  87.   void *malloc_3(size_t);
  88.   void free_3(void *);
  89.   void _malloc_3(void);
  90.   void _free_3(void);
  91.  
  92.   void _free(void)
  93.   { _free_3(); }
  94.  
  95.   void _malloc(void)
  96.   { _malloc_3(); }
  97.  
  98.   #define malloc         malloc_3
  99.   #define free           free_3
  100.  
  101.   #define LibCreatePool  CreatePool
  102.   #define LibDeletePool  DeletePool
  103.   #define LibAllocPooled AllocPooled
  104.   #define LibFreePooled  FreePooled
  105. #endif
  106.  
  107. /*----- stormamiga-special-functions -----*/
  108.  
  109. long  muls            (long, long);
  110. ulong mulu            (ulong, ulong);
  111. long  divsl           (long, long);
  112. ulong divul           (ulong, ulong);
  113. long  muls64          (long, long);
  114. ulong mulu64          (ulong, ulong);
  115. long  divs64          (long, long);
  116. ulong divu64          (ulong, ulong);
  117. int   button          (int, int);
  118. int   button_al       ();
  119. int   button_ar       ();
  120. int   button_bl       ();
  121. int   button_br       ();
  122. void  waitbutton      (int, int);
  123. void  waitbutton_al   ();
  124. void  waitbutton_ar   ();
  125. void  waitbutton_bl   ();
  126. void  waitbutton_br   ();
  127. int   max_Width       (struct Window *);
  128. int   max_Height      (struct Window *);
  129.  
  130. /*----- support for UNIX-functions -----*/
  131.  
  132. char *UnixToAmigaPath (cchar *);
  133.  
  134. #ifdef __cplusplus
  135.   }
  136. #endif
  137.  
  138. #ifdef STORMAMIGA_INLINE
  139.  
  140. /*----- amiga.lib-functions -----*/
  141.  
  142. #define DeleteTask       RemTask
  143. #define CreateExtIO      CreateIORequest
  144. #define DeleteExtIO      DeleteIORequest
  145. #define DeleteStdIO      DeleteIORequest
  146.  
  147. __inline void RemTOF     (struct Isrvstr *intr)
  148. { RemIntServer           (INTB_VERTB, (struct Interrupt *) intr); }
  149.  
  150. __inline struct IOStdReq *CreateStdIO (struct MsgPort *port)
  151. { return (struct IOStdReq *) CreateIORequest (port, sizeof (struct IOStdReq)); }
  152.  
  153. __inline void waitbeam   (long pos)
  154. { do {} while (pos > VBeamPos ()); }
  155.  
  156. __inline void NewList    (struct List *list)
  157. {
  158.   long *p;
  159.   list -> lh_TailPred = (struct Node *) list;
  160.   list = (struct List *)((char *) list + sizeof (LONG));
  161.   *(long *) list = 0;
  162.   p = (long *) list;
  163.   *-- p = (long) list;
  164. }
  165.  
  166. /*----- Amiga-functions -----*/
  167.  
  168. #define Move             Move_
  169. #define GetAPen          GetAPen_
  170. #define GetBPen          GetBPen_
  171. #define GetDrMd          GetDrMd_
  172. #define GetOutlinePen    GetOutlinePen_
  173.  
  174. __inline void Move_      (struct RastPort *rp, long x, long y)
  175. {
  176.   rp -> cp_x = x;
  177.   rp -> cp_y = y;
  178. }
  179.  
  180. __inline ulong GetAPen_  (struct RastPort *rp)
  181. { return rp -> FgPen; }
  182.  
  183. __inline ulong GetBPen_  (struct RastPort *rp)
  184. { return rp -> BgPen; }
  185.  
  186. __inline ulong GetDrMd_  (struct RastPort *rp)
  187. { return rp -> DrawMode; }
  188.  
  189. __inline ulong GetOutlinePen_ (struct RastPort *rp)
  190. { return rp -> AOlPen; }
  191.  
  192. /*----- stormamiga-special-functions -----*/
  193.  
  194. __inline long  muls      (long arg1, long arg2)
  195. { return (arg1 * arg2); }
  196.  
  197. __inline ulong mulu      (ulong arg1, ulong arg2)
  198. { return (arg1 * arg2); }
  199.  
  200. __inline int max_Width   (struct  Window *window)
  201. { return (window -> Width - window -> BorderLeft - window -> BorderRight); }
  202.  
  203. __inline int max_Height  (struct Window *window)
  204. { return (window -> Height - window -> BorderTop - window -> BorderBottom); }
  205. #endif  /* STORMAMIGA_INLINE */
  206.  
  207. #endif  /* PPC */
  208. #endif  /* STORMAMIGA_H */
  209.